let common = {
    alert: function (msg, btn) {
        if (btn == undefined) {
            btn = '确定';
        }

        layer.open({
            content: msg
            , btn: btn
        });
    }
}

function getJsonLength(jsonData) {
    let jsonLength = 0;
    for (let item in jsonData) {
        jsonLength++;
    }
    return jsonLength;

}

//整数判断
function isInt(str) {
    let reg = /^[0-9]+$/;
    return reg.test(str);
}

//二维码
function qrcode(act_id, mymobile) {
    var title = mymobile ? '您的活动专属二维码' : '活动二维码';
    var url;
    if (mymobile) {
        url = 'http://bshare.optimix.asia/barCode?site=weixin&url=http://' + document.domain + '/act/' + act_id + '/' + mymobile;
    } else {
        url = 'http://bshare.optimix.asia/barCode?site=weixin&url=http://' + document.domain + '/act/' + act_id;
    }

    layer.open({
        title: [
            title,
            'background-color: #FF4351; color:#fff;'
        ]
        , content: "<img src='" + url + "'/>"
    });
}


export default common;